
module dwt.internal.dwteventobject;

private import dwt.dwt;

/**
 * The root class from which all event state objects shall be derived.
 * All Events are constructed with a reference to the object, the "source",
 * that is logically deemed to be the object upon which the Event in question
 * initially occurred upon.
 */

public class DWTEventObject { //: java.io.Serializable {
	/**
	 * The object on which the Event initially occurred.
	 */
	protected Object source;

	/**
	 * Constructs a prototypical Event.
	 */
	public this(Object source) {
		if (source !is null) {
			this.source = source;
		} else {
			throw new Exception("null source");
		}
	}

	/**
	 * The object on which the Event initially occurred.
	 */
	public Object getSource() {
		return source;
	}

	/**
	 * Returns a String representation of this EventObject.
	 */
	public char[] toString() {
		
		return this.classinfo.name ~ "[source=" ~ (source ? source.toString() : "null") ~ "]";
	}

}